﻿@echo off

rem 待备份目录
set src_dir=D:\soft\Steam\steamapps\common\PalServer\Pal\Saved
D:
cd D:\soft\git-repo\pl-save-backup

rd /s /q config
rd /s /q SaveGames

mkdir config
mkdir SaveGames

xcopy /s /e /i "%src_dir%\config" config
xcopy /s /e /i "%src_dir%\SaveGames" SaveGames


for /f "tokens=2 delims==" %%G in ('wmic os get localdatetime /value') do set "dateTime=%%G"
set "currentDateTime=%dateTime:~2,2%%dateTime:~4,2%%dateTime:~6,2%-%dateTime:~8,2%%dateTime:~10,2%"

git checkout --orphan %currentDateTime%

git add .
git commit -m "Backup at %currentDateTime%"

git push origin %currentDateTime%

pause